# 测试环境数据库
import logging


# sql_ip = "oranllc-dev-db.rwlb.rds.aliyuncs.com"
# sql_port = 33006
# sql_user = "oranllc"
# sql_pwd = "Oran1@#$"
# sql_Database = "tms"
# realmName = "http://dev.oranllc.com/tms/api/app/"
# realmNameToken = "http://auth-dev.oranllc.com/"
# global orders
# realmName = "http://tms2-sit.bxgt.com/tms/api/app/"
# realmNameToken = "http://auth-sit.bxgt.com/"
# bsdName = "http://devops.bxgt.com"


# salesRealmName = "http://sales-test.bxgt.com:8081/"
# # 预发环境数据库
# sql_ip = "10.10.92.139"
# sql_port = 33006
# sql_user = "root"
# sql_pwd = "oranLLC8"
# sql_Database = "TMS"


e = {
    "dev": {
        "sql_ip": "oranllc-dev-db.rwlb.rds.aliyuncs.com",
        "sql_port": 33006,
        "sql_user": "oranllc",
        "sql_pwd": "Oran1@#$",
        "sql_Database": "tms",
        "realmName": "http://dev.oranllc.com/tms/api/app/",
        "realmNameToken": "http://auth-dev.oranllc.com/",
    },
    "yf": {
        "sql_ip": "10.10.92.139",
        "sql_port": 33006,
        "sql_user": "root",
        "sql_pwd": "oranLLC8",
        "sql_Database": "TMS",
        "realmName": "http://tms2-sit.bxgt.com/tms/api/app/",
        "realmNameToken": "http://auth-sit.bxgt.com/",
    },
}


class Environment:
    status = None

    def __init__(self, local: str, logger: logging.Logger):
        if local not in e:
            self.status = "环境不存在"
            return
        else:
            self.status = e[local]["realmName"]
        self.ip = e[local]["realmName"]
        self.token_ip = e[local]["realmNameToken"]
        self.sql_ip = e[local]["sql_ip"]
        self.sql_port = e[local]["sql_port"]
        self.sql_user = e[local]["sql_user"]
        self.sql_pwd = e[local]["sql_pwd"]
        self.sql_Database = e[local]["sql_Database"]
        self.realmName = e[local]["realmName"]
        self.realmNameToken = e[local]["realmNameToken"]
        self.logger = logger
        self.logger.info(f"当前环境：{self.realmName}")
